
function popupCollectShop(id){
  
    $.ajax({
        type: 'Post',
        url: edp_domain_url + 'ajax_collect/?type=shop&tiny=1',
        dataType: 'json',	
		data:{collectID: id},
		timeout: 5000,
		global:false,
	    beforeSend: function(){
		  $.blockUI({ 
			     message: '正在获取...',
			     css: {padding:'5px',color:'#CC0000'}});
		  },
		error: function(){
		   $.blockUI({ 
			     message: '获取出错...',
			     css: {padding:'5px',color:'#CC0000'}});
			  $.unblockUI();
			},
        success: function(data){
            if(data.login==false){               
                popupLogin($('#collectShopBox'),'收藏店铺');                
                  
            }else{
                popupCollect($('#collectShopBox'),'collectShopForm', $(".shop_title_text").text(),'收藏店铺','shop',id,data.favTagsList,data.removeBtn,data.favTags);                     
            } 
	 	  
		    $.blockUI({ 
			 	message: $('#collectShopBox'),    
			 	css: { 
			        padding:        0,
			        margin:         0,
			        top:            '30%', 
       				left:           '35%', 
			        width:          '',
			        textAlign:      '', 
			        color:          '', 
			        border:         '',
			        backgroundColor:'',       				
			        cursor:         'wait'				        
   				 }}); 			  			 	 
           }
      });               
}
 



$(document).ready(function(){
 
 	
   	$("#sToogle").toggle(function(){
   	    $("#shopDes").show();
		$("#shopDes").css({"padding":"0 100px 10px 20px","height":"auto","overflow-x":"hidden","overflow-y":"auto"});
		$(this).css({"background":"#F9FCF1 url("+edp_static_domain_url+"image/icn_doHide.gif) no-repeat left"});
		$(this).html("<span>[收起]</span>");
	},function(){
	    $("#shopDes").hide();
		$(this).css({"background":"#F9FCF1 url("+edp_static_domain_url+"image/icn_doShow.gif) no-repeat left"});
		$(this).html("<span>[展开]</span>");
	});     
   	
   	$('.stuff_pic').each(function(){	
   			$(this).find('a').lightBox();
   	});    
	
	$('#recent_review_c').marquee({time: 3000, step: 25});
    $('#recent_review_c').hover(function(){$('#recent_review_c').marqueeStop()},function(){$('#recent_review_c').marqueePlay()}); 


});



$(document).ready(function(){

	LoadSortbyClass();

	$( "#sortflower_count" ).click(
		function(){
			SortbySubmit( "flower_count" );
                        return false;
		}
	);
	$( "#sortview_count" ).click(
		function(){
			SortbySubmit( "view_count" );
                        return false;
		}
	);
	$( "#sortreview_date" ).click(
		function(){
			SortbySubmit( "review_date" );
                        return false;
		}
	);
	$( "#sortcontribution" ).click(
		function(){
			SortbySubmit( "contribution" );
                        return false;
		}
	);
		   
});
		   
		   		   
		   
//for review functions
function LoadSortbyClass(){
	var sortby = $( "#sortby" ).val();

        var id = sortby.substring( 0, sortby.indexOf("-") );
        var sortType = sortby.substring( sortby.indexOf("-")+1, sortby.length );

        $( "#sort"+id ).addClass( "selectedSortby" );
        if( sortType == "asc" ){
            $( "#sort"+id ).append( "<img src=\""+edp_static_domain_url+"image/arrow4.gif\" />" );
        }
        else{
            $( "#sort"+id ).append( "<img src=\""+edp_static_domain_url+"image/arrow5.gif\" />" );
        }

}

function SortbySubmit( type ){
	//reset the sort by selector
	var sortby = $( "#sortby" ).val();
	if( sortby == type+"-asc" ){
		$( "#sortby" ).val( type+"-desc" );
	}
	else if( sortby == type+"-desc" ){
		$( "#sortby" ).val( type+"-asc" );
	}
	else{
		$( "#sortby" ).val( type+"-asc" );
	}
	$( "#reviewform" ).submit();
}

function go_shopping(url){	
	window.open(url, '_blank');
	return false;
}


$(window).load(function() {

	$(".shop_info_02 img").each(function() {
	
	 if((typeof this.naturalWidth != "undefined" && this.naturalWidth == 0 ) || this.readyState == 'uninitialized' ){
					
			this.src = edp_static_domain_url+'image/defaultpicture80.gif';
	}});
	
});
